import React, { Component } from 'react';

// 引入mockjs 
import Mock from "mockjs";

// 模拟列表数据 
let data = Mock.mock({
    "list|3": [{
        "id": "@id",
        "img":"@image(50x50,@color)",
        "title": "@ctitle(4)",
        "price|10-20.2": 10
    }]
})

export class List extends Component {
    render() {
        return (
            <div>
                <ul className='list'>
                    {
                        data.list.map(item => {
                            return <li key={item.id} >
                                <img src={item.img} alt="" />
                                <p>{item.title}</p>
                                <p>￥{item.price}</p>
                            </li>
                        })
                    }
                </ul>
            </div>
        )
    }
}

export default List